package com.sun.entitys.users;


import com.sun.entitys.BaseEntity;
import com.sun.enums.EUserType;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * MP自动填充Handler
 *
 * @Author sun
 * @CreateTime 2025/9/6 18:58
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Table(name = "t_user")
@Schema(description = "用户表")
public class User extends BaseEntity {
    @Schema(description = "用户名")
    private String username;
    @Schema(description = "密码")
    private String password;
    @Schema(description = "邮箱")
    private String phone;
    @Schema(description = "微信openid")
    private String openid;

    @Schema(description = "用户类型")
    @Enumerated(EnumType.ORDINAL)
    private EUserType type;

    @ManyToMany
    @JoinTable(name = "t_user_role", joinColumns = @JoinColumn(name = "userId"), inverseJoinColumns = @JoinColumn(name = "roleId"))
    private List<Role> roles;

}
